//
//  IMChatDefines.h
//  ChatMainDemo
//
//  Created by peiw on 16/1/21.
//  Copyright © 2016年 peiw. All rights reserved.
//

#import <Foundation/Foundation.h>

//SIZE
#define AvatarSize              40
#define ChatCellNameWidth       200
#define ChatCellNameHeight      15
#define IMAvatarEdge            10            //头像->边缘距离
#define IMAvatarBubbleGap       5       //头像->气泡距离
#define IMBubbleUpDown          20          //气泡->上下边缘距离
#define IMBubbleContentGap      20

// 屏幕高度
#define SCREEN_HEIGHT         [[UIScreen mainScreen] bounds].size.height
// 屏幕宽度
#define SCREEN_WIDTH          [[UIScreen mainScreen] bounds].size.width

//FONT
#define SystemFont(size)        [UIFont systemFontOfSize:size]
#define BoldSystemFont(size)    [UIFont boldSystemFontOfSize:size]

#define ChatContentFont                SystemFont(15)
#define ChatNameFont            SystemFont(11)

//COLOR
#define RGBA(r,g,b,a)         [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define RGB(r,g,b)            [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]
#define RGB_A(rgb,a)          [UIColor colorWithRed:((rgb>>16) & 0xff)/255.0 green:((rgb>>8) & 0xff)/255.0 blue:(rgb & 0xff)/255.0 alpha:a]

#define ClearColor              [UIColor clearColor]
#define ChatNameTextColor    RGB(102, 102, 102)

//IMAGE
#define ChatBubbleTo        @"chat_mine_node"
#define ChatBubbleFrom       @"chat_peer_node"

//OTHER
#define dispatch_main_sync_safe(block)\
if ([NSThread isMainThread]) {\
block();\
} else {\
dispatch_sync(dispatch_get_main_queue(), block);\
}